var express = require('express');
var router = express.Router();

var Article = require('../models/article')


router.get('/', function (req, res) {
  Article.getAll(function (err, articles) {
    if (err) {
      console.log('home.js fail. err = ' + err)
      next()
    } else {
      res.render('admin', {
        title: '后台管理页',
        list: articles
      })
    }
  })
})


module.exports = router;
